// Counter类与操作符重载

#include <iostream>
using namespace std;

class Counter {
private:
    int count;

public:
    Counter() { count = 0; }
    void operator++() { count++; }
    // void operator++(int); // 后缀形式
    void operator--() { count--; }
    void Reset() { count = 0; }
    int GetCount() { return count; }
};

int main() {
    Counter myCount, yourCount;
    int number = 0;

    ++myCount;
    ++yourCount;
    ++number;

    cout << "myCount = " << myCount.GetCount() << "\n";
    cout << "yourCount = " << yourCount.GetCount() << "\n";
    cout << "number = " << number << "\n";

    ++myCount;
    --yourCount;
    --number;

    cout << "\n";
    cout << "myCount = " << myCount.GetCount() << "\n";
    cout << "yourCount = " << yourCount.GetCount() << "\n";
    cout << "number = " << number << "\n";

    cout << "完毕\n";
}